package com.minelx.datamicroscope.core.condition;

import com.alibaba.fastjson.JSONObject;
import io.gitee.minelx.commontools.factor.Factor;

import static java.util.Collections.singletonList;

class RawStickyOperandCondition implements RawCondition {
    private final KeyOperandCondition self;

    RawStickyOperandCondition(KeyOperandCondition self) {
        this.self = self;
    }

    @Override
    public Factor<Condition> toFactor() {
        return Factor.fromList(singletonList(self));
    }

    @Override
    public JSONObject toJSON() {
        JSONObject result = new JSONObject();
        result.put("operator", "sticky");
        result.put("condition", self.toJSON());
        return result;
    }
}
